﻿using System;
using System.Windows.Forms;
using System.IO;

namespace AIMLBattleground1
{
    public partial class Form1 : Form
    {

        public string NameOfPlugin = "AIMLBattleground";
        public string DoubleDash = "\\";
        public string DashRight = "/";
        public string IgnoreListPath = "Plugins" + "\\" + "AIMLBattleground" + "\\" + "ignore" + "\\";
        public string MainPath = "Plugins" + "\\" + "AIMLBattleground" + "\\" + "logs" + "\\";
        public string DayShort = String.Format("{0:dd}", DateTime.Now.DayOfWeek.ToString());
        public string Month = String.Format("{0:mmmm}", DateTime.Now.Month.ToString());
        public string Day = String.Format("{0:dddd}", DateTime.Now.Day.ToString());
        public string Year = String.Format("{0:yyyy}", DateTime.Now.Year.ToString());
        public char[] CharsToTrim = { '.' };
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (File.Exists(MainPath + DoubleDash + Year + DoubleDash +
                Month + DoubleDash + DayShort + DoubleDash + Day + ".txt"))
            {
                using (StreamReader reader = new StreamReader(MainPath + Year + DoubleDash + Month +
                    DoubleDash + DayShort + DoubleDash + Day + ".txt"))
                {
                    const char find = ',';
                    string[] all = reader.ReadToEnd().Split(find);
                    foreach (string line in all)
                    {
                        if (line != null)
                            RtbAimlBattlegroundLog.AppendText(line);
                    }
                }
            }
            if (File.Exists(IgnoreListPath + "ignoreList.txt"))
            {
                using (StreamReader ignoreReader = new StreamReader(IgnoreListPath + "ignoreList.txt"))
                {
                    const char find = ',';
                    string[] all = ignoreReader.ReadToEnd().Split(find);
                    foreach (string line in all)
                    {
                        if (line != null)
                            RtbAIMLBattlegroundIgnoredUsersLog.AppendText(line);
                    }
                }
            }
        }
        
        private void SaveButton_Click(object sender, EventArgs e)
        {
             MIRsettings.Instance.Save();
        }

        private void BattlegroundChatReceived_TextChanged(object sender, EventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void listBox1_SelectedIndexChanged_1(object sender, EventArgs e)
        {

        }

        private void richTextBox1_TextChanged_1(object sender, EventArgs e)
        {

        }

        private void listBox1_SelectedIndexChanged_2(object sender, EventArgs e)
        {

        }

        private void richTextBox1_TextChanged_2(object sender, EventArgs e)
        {

        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void groupBox4_Enter(object sender, EventArgs e)
        {

        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {

        }
    }
}
